package com.nameless.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nameless.dao.CouponMapper;
import com.nameless.entity.*;
import com.nameless.feign.CarFeign;
import com.nameless.feign.CarsFegin;
import com.nameless.service.CouponService;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * -*- coding:utf-8 -*-
 *
 * @author 太阳偷渡青山
 * @software IntelliJ IDEA
 * @date 2023/02/27 9:47
 * @Description
 */
@Service
@Slf4j
public class CouponServiceImpl extends ServiceImpl<CouponMapper, Coupon> implements CouponService {

    @Autowired
    private CarFeign carFeign;

    @Override
    public List<Shop> getOtherInfo() {
        return carFeign.selectShopAll();
    }

    @Autowired
    private CarsFegin carsFegin;

    @Override
    public Map<String, Object> getOtherInfoByShopId(Integer shopId) {
        List<Car> carList = carsFegin.getCarByShopId(shopId);
        List<Brand> brandList = carsFegin.getBrandByShopId(shopId);
        Map<String, Object> map = new HashMap<>();
        map.put("carList",carList);
        map.put("brandList",brandList);
        return map;
    }
}
